package ModelLayer;

/**
 * Vestbjerg project
 * @GroupB2 (UCN - Computer Science DMAJ0914) 
 */
public class Product extends Item 
{
    // instance variables
    private int parLvl;
    private int maxAmt;
    private int discount;
    private int stockAmt;
    private String location;
    
    /**
     * Constructor for objects of class Product
     */
    public Product(String barcode, String name, String description, double price, int parLvl, int maxAmt,
    int discount, int stockAmt, String location)
    {
        super(barcode, name, description, price);
        this.parLvl = parLvl;
        this.maxAmt = maxAmt;
        this.discount = discount;
        this.stockAmt = stockAmt;
        this.location = location;
    }

    public void setParLvl(int parLvl)
    {
        this.parLvl = parLvl;
    }

    public void setMaxAmt(int maxAmt)
    {
        this.maxAmt = maxAmt;
    }

    public void setDiscount(int discount) 
    {
        this.discount = discount;
    }

    public void setStockAmt(int stockAmt)
    {
        this.stockAmt = stockAmt;
    }
    
    public void setLocation(String location) 
    {
        this.location = location;
    }
    
    public String getLocation() 
    {
        return location;
    }

    public int getParLvl()
    {
        return parLvl;
    }

    public int getMaxAmt()
    {
        return maxAmt;
    }
    
    public int getDiscount()
    {
        return discount;
    }
    
    public int getStockAmt()
    {
        return stockAmt;
    }
    

    public void restock() 
    {
        if(stockAmt < parLvl) 
        {
            stockAmt = maxAmt;
        }
    }
    
    public void updateStock(int amount) 
    {
        stockAmt -= amount;
    }   
}